package com.inspur.edp.rule.dsl.core.function;

/**
 * @author lizhaorui
 * @description TODO
 * @date 2024/12/31 11:47
 */
public class MathUtils {

    public static double abs(double a) {
        return Math.abs(a);
    }

    public static double round(double a) {
        return Math.round(a);
    }

    public static double random() {
        return Math.random();
    }

    public static double sin(double a) {
        return Math.sin(a);
    }

    public static double cos(double a) {
        return Math.cos(a);
    }

    public static double ceil(double a) {
        return Math.ceil(a);
    }

    public static double floor(double a) {
        return Math.floor(a);
    }

    public static boolean isGreaterThan(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 > value2;
    }

    public static boolean isGreaterThanEqual(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 >= value2;
    }

    public static boolean isLessThan(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 < value2;
    }

    public static boolean isLessThanEqual(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 <= value2;
    }

    public static boolean isEqual(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 == value2;
    }

    public static boolean isNotEqual(Number number1, Number number2) {
        double value1 = number1.doubleValue();
        double value2 = number2.doubleValue();
        return value1 != value2;
    }

}
